package com.edu.learning.test;

import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.List;

/**
 * @author ll
 * @Date 2018/1/2 20:14
 */
public class Main {
    static void mutateInt(int a, int newVal) {
        try {
            Field value = Integer.class.getDeclaredField("value");
            value.setAccessible(true);
            value.set(a, newVal);
        } catch (ReflectiveOperationException e) {
            // pass
        }
    }

    public static void main(String[] args) {
        List<Integer> avoidOptimazation = new ArrayList<>();
        final int n = 0;
        Integer integer;
        do {
            mutateInt(n, n + 1);
            integer = Integer.valueOf(n);
            avoidOptimazation.add(integer);
        } while (integer.intValue() != n);
        System.out.println(n);
        System.out.println("ignore this line: " + avoidOptimazation.size());
    }
}
